<template>
	<view class="search-box">
		<u-search shape="square" @search="onSearch()" :clearabled="false" @change="onChange" :value="word" :searchIconColor="stColor" :borderColor="stColor" bgColor="#fff" :showAction="false" :placeholder="placeholder" height="30"></u-search>
		<view @click="onSearch()" :style="{'--st_color': stColor}" class="search-bnt">搜索</view>
	</view>
</template>

<script>
	export default {
		name: 'customSearch',
		props: {
			word: {
				type: String,
				default: ''
			},
			stColor: {
				type: String,
				default: '#2878ff'
			},
			placeholder: {
				type: String,
				default: '请输入要搜索的内容'
			},
		},
		methods: {
			onChange(str) {
				this.$emit('update:word', str);
			},
			onSearch() {
				this.$emit('onSearch')
			},
		},
	}
</script>

<style scoped lang="scss">
	.search-box {
		position: relative;
	}
	.search-bnt {
		position: absolute;
		right: 0rpx;top: 0rpx;
		background: var(--st_color);
		border-top-right-radius: 6px;
		border-bottom-right-radius: 6px;
		height: 32px;
		line-height: 32px;
		width: 60px;
		text-align: center;
		color: #fff;
		font-size: 13px;
		z-index: 2;
	}
	.search-box ::v-deep .u-search__content__input {
		margin: 0 60px 0 5px;
	}
</style>